<?php
class App_Model
{
	static private $_models = array();
	
	private function __construct(){}
	
	private function __clone(){}
	
	static public function factory($name)
	{
		if (array_key_exists($name, self::$_models)) {
			return self::$_models[$name];
		}
		
		$className = 'App_Model_' . $name;
		$classFile = _LIB_DIR_ . '/App/Model/' . $name . '.php';
		
		$return = '';
		
		if (file_exists($classFile)) {
			$return = new $className();
			self::$_models[$name] = $return;
		}
		
		return $return;
	}
}